#include"func.h"

int logrecord(char* order){
    char buf[1024];
    memset(buf,0, sizeof(buf));
    strcpy(buf,order);
    time_t curtime =time(NULL);
    char* printtime=ctime(&curtime);
    char nowtime[1024];
    strncpy(nowtime,printtime, strlen(printtime)-1);
    FILE *fp;
    fp=fopen("./log","a+");
    if(!fp)
    {
        fp = fopen("./log","w+");
    }
    char mid[10]=" --> ";
    strcat(nowtime,mid);
    strcat(nowtime,buf);
    fputs(nowtime,fp);
    memset(nowtime,0, sizeof(nowtime));
    fclose(fp);
    return 0;
}
